<template>
	<view>
		<uv-navbar leftText="返回" autoBack="true" title="设置" @leftClick="leftClick"></uv-navbar>
		
		<view class="settings">
			<uv-cell-group :border="false">
				<uv-cell v-for="item, index in settings_data" :key="index" :isLink="true" :cellStyle="{padding: '15px 15px'}" @click="infoClick(index)">
					<!-- 自定义左侧标题 -->
					<template v-slot:title>
						<uv-text :text="item.title"></uv-text>
					</template>
					<!-- 自定义左侧图标 -->
					<template v-slot:icon>
						<uv-icon size="35rpx" :name="item.icon"></uv-icon>
					</template>
					<!-- 自定义右侧图标 -->
					<template v-slot:right-icon>
						<uv-icon size="30rpx" name="arrow-left"></uv-icon>
					</template>
				</uv-cell>
			</uv-cell-group>
			
			<view class="form_submit_class">
				<uv-button :hairline="false" text="退出登录" customTextStyle="color: #2c9c3c;font-size: 28rpx" @click="exitLogin"></uv-button>
			</view>
			
		</view>
		
	</view>
</template>

<script>
	export default {
		data() {
			return {
				settings_data: [{
					title: '个人信息', icon: 'account-fill'
				},{
					title: '诊所', icon: 'coupon-fill'
				},{
					title: '医生', icon: 'pushpin-fill'
				},{
					title: '护士', icon: 'pushpin-fill'
				},{
					title: '复诊电手', icon: 'server-fill'
				}]
			}
		},
		methods: {
			leftClick() {
				uni.navigateBack();
			},
			infoClick(inx) {
				if (inx === 0) {
					this.userinfoClick()
				}
				if (inx === 1) {
					this.clinicChangeClick()
				}
				if (inx === 2) {
					this.medicClick()
				}
				if (inx === 3) {
					this.nurseClick()
				}
				if (inx === 4) {
					this.visitClick()
				}
			},
			userinfoClick() {
				uni.navigateTo({
					url:'/pages/settings/components/info_user/info_user'
				})
			},
			clinicChangeClick() {
				uni.navigateTo({
					url:'/pages/settings/components/change_clinic/change_clinic'
				})
			},
			medicClick() {
				uni.navigateTo({
					url:'/pages/settings/components/change_medic/change_medic'
				})
			},
			nurseClick() {
				uni.navigateTo({
					url:'/pages/settings/components/change_nurse/change_nurse'
				})
			},
			visitClick() {
				uni.navigateTo({
					url:'/pages/settings/components/change_visit/change_visit'
				})
			},
			exitLogin() {
				// uni.clearStorage()
				uni.reLaunch({
				    url:'/pages/login/login'
				})
			}
		}
	}
</script>

<style lang="scss">
		
	.settings {
		margin-top: 180rpx;
	}
	
	.form_submit_class {
		padding-top: 20px;
	}
</style>
